package com.XX;


import com.github.pagehelper.PageInfo;
import com.pojo.User;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

public class test01 {

    private void printArgs(String... str) {
        for (String s : str) {
            System.out.println(s);
        }
    }

    private final List<User> userList = new ArrayList<User>();

    {
        userList.add(new User("张三", "北京", "123456", "13812345678"));
        userList.add(new User("李四", "上海", "123456", "13812345678"));
        userList.add(new User("王五", "深圳", "123456", "13812345678"));
    }

    ;

    @Test
    public void test01() {
        printArgs("aaa", "bbb", "w");
    }

    @Test
    public void test02() {
        PageInfo<User> pageInfo = new PageInfo<>(userList, 2);
        List<User> list = pageInfo.getList();
        String str = "1";

        System.out.println(list);

    }

    @Test
    public void test03() {
        HashMap<String, String> map = new HashMap<>();
        map.put("1", "11");
        double v = Double.parseDouble("");

        System.out.println(map);

    }

    @Test
    public void test04() {
        String[] originalArray = {"1", "2", "3", "4", "5"}; // 原始的 String 数组，这里假设有 1000 个元素
        // 初始化原始数组...

        int batchSize = 2; // 指定每个子 List 的大小

        List<List<String>> subLists = new ArrayList<>(); // 用于存放分割后的子 List

        for (int i = 0; i < originalArray.length; i += batchSize) {
            int end = Math.min(originalArray.length, i + batchSize);
            List<String> subList = Arrays.asList(Arrays.copyOfRange(originalArray, i, end));
            subLists.add(subList);
        }

        // 打印分割后的子 List
        for (List<String> subList : subLists) {
            System.out.println(subList);
        }

    }


    @Test
    public void test05() {
        Object s = new Object();
        if (s instanceof String) {
            if (s == null) {
                System.out.println("空");
            } else {
                System.out.println("不为空");
            }
        } else {
            System.out.println("不是String");
        }

    }


}
